package com.example.demo.vo.webvo

import com.example.demo.dbmodels.TUser
import io.swagger.annotations.ApiModelProperty
import java.time.LocalDateTime

class UserVo {

    @ApiModelProperty(name = "id", value = "用户id")
    var id: Int? = null

    @ApiModelProperty(name = "district_code", value = "病区号")
    var district_code: String? = null

    @ApiModelProperty(name = "user_code", value = "用户代码")
    var user_code: String? = null

    @ApiModelProperty(name = "user_name", value = "用户名称")
    var user_name: String? = null

    @ApiModelProperty(name = "user_type", value = "用户类型")
    var user_type: String? = null

    @ApiModelProperty(name = "password", value = "密码")
    var password: String? = null

    @ApiModelProperty(name = "sex", value = "性别（0-男、1-女、2-未知）")
    var sex: Int? = null

    @ApiModelProperty(name = "date_birth", value = "出生日期")
    var date_birth: LocalDateTime? = null

    @ApiModelProperty(name = "birthplace", value = "籍贯")
    var birthplace: String? = null

    @ApiModelProperty(name = "mobile", value = "手机")
    var mobile: String? = null

    @ApiModelProperty(name = "phone", value = "电话")
    var phone: String? = null

    @ApiModelProperty(name = "email", value = "email")
    var email: String? = null

    @ApiModelProperty(name = "id_number", value = "证件号码")
    var id_number: String? = null

    @ApiModelProperty(name = "id_number_type", value = "证件类型")
    var id_number_type: String? = null

    @ApiModelProperty(name = "pca_code", value = "行政区代码")
    var pca_code: String? = null

    @ApiModelProperty(name = "address", value = "地址")
    var address: String? = null

    @ApiModelProperty(name = "password_question", value = "密码问题")
    var password_question: String? = null

    @ApiModelProperty(name = "password_answer", value = "密码答案")
    var password_answer: String? = null

    @ApiModelProperty(name = "last_login", value = "最后登录时间")
    var last_login: LocalDateTime? = null

    @ApiModelProperty(name = "reg_time", value = "注册时间")
    var reg_time: LocalDateTime? = null

    @ApiModelProperty(name = "user_state", value = "用户状态(0-正常、1-冻结、2-销户、3--锁定、4-账号过期)")
    var user_state: Int? = null

    @ApiModelProperty(name = "terminal", value = "注册终端(0-Web、1-安卓、2-IOS、99-接口用)")
    var terminal: Int? = null

    @ApiModelProperty(name = "terminal", value = "状态1=有效，0=无效")
    var status: Boolean? = null

    @ApiModelProperty(name = "remark", value = "备注")
    var remark: String? = null

    @ApiModelProperty(name = "photo_url", value = "头像路径")
    var photo_url: String? = null

    @ApiModelProperty(name = "default_page", value = "默认主页")
    var default_page: String? = null

    @ApiModelProperty(name = "token", value = "token")
    var token: String? = null

    @ApiModelProperty(name = "update_time", value = "更新时间")
    var update_time: LocalDateTime? = null

    @ApiModelProperty(name = "update_by", value = "更新人")
    var update_by: Int? = null

    @ApiModelProperty(name = "is_del", value = "删除标记")
    var is_del: Boolean? = null


    fun getVo(table: TUser): UserVo {
        table.let {
            val data = UserVo()
            data.address = it.address
            data.birthplace = it.birthplace
            data.date_birth = it.date_birth
            data.default_page = it.default_page
            data.district_code = it.district_code
            data.email = it.email
            data.id = it.id
            data.id_number = it.id_number
            data.id_number_type = it.id_number_type
            data.is_del = it.is_del
            data.last_login = it.last_login
            data.mobile = it.mobile
            data.password = it.password
            data.password_answer = it.password_answer
            data.password_question = it.password_question
            data.pca_code = it.pca_code
            data.phone = it.phone
            data.photo_url = it.photo_url
            data.reg_time = it.reg_time
            data.remark = it.remark
            data.sex = it.sex
            data.status = it.status
            data.terminal = it.terminal
            data.token = it.token
            data.update_by = it.update_by
            data.update_time = it.update_time
            data.user_code = it.user_code
            data.user_name = it.user_name
            data.user_state = it.user_state
            data.user_type = it.user_type
            return  data
        }
    }

}